package svc

import (
	"book/service/sstwords/cmd/api/internal/config"
	"book/service/sstwords/cmd/rpc/sstwordsclient"
	"book/service/user/cmd/rpc/userclient"

	"github.com/tal-tech/go-zero/zrpc"
)

type ServiceContext struct {
	Config      config.Config
	SstwordsRpc sstwordsclient.Sstwords
	UserRpc     userclient.User
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:      c,
		SstwordsRpc: sstwordsclient.NewSstwords(zrpc.MustNewClient(c.SstwordsRpc)),
		UserRpc:     userclient.NewUser(zrpc.MustNewClient(c.UserRpc)),
	}
}
